/**
 * 
 */
package com.alstudio.module.xmpp.protocol.xmpp.util.xmlcreator.iq.useroption;

import com.alstudio.module.xmpp.protocol.xmpp.packact.ALXmppDomainConfig;
import com.alstudio.module.xmpp.protocol.xmpp.packact.IQNameSpace;
import com.alstudio.module.xmpp.protocol.xmpp.util.xmlcreator.AlXmlTag;
import com.alstudio.module.xmpp.protocol.xmpp.util.xmlcreator.iq.BaseIQTemplate;

/**
 * 提交语音介绍
 * 
 * @author alonso lee
 * 
 */
public class CommitVoiceIntroIQCreator extends BaseIQTemplate {

	private String url;
	private String len;

	/**
	 * 
	 */
	public CommitVoiceIntroIQCreator(String url, String len, String domain) {
		// TODO Auto-generated constructor stub
		this.url = url;
		this.len = len;
		this.domain = domain;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.alstudio.module.xmpp.protocol.xmpp.util.xmlcreator.iq.BaseIQTemplate
	 * #getIQXml()
	 */
	@Override
	public String getIQXml() {
		// TODO Auto-generated method stub


		mALIQCreator.setNs(IQNameSpace.NS_VOICE_INTRO);
		to = ALXmppDomainConfig.getALXmppDomainConfig().getDomainByNameSpace(mALIQCreator.getNs());
		mALIQCreator.setTo(to + domain);
		mALIQCreator.setType(IQ_TYPE_SET);

		// 语音文件连接
		AlXmlTag tag = new AlXmlTag("url");
		tag.setText(url);
		tagList.add(tag);

		// 保存
		tag = new AlXmlTag("save");
		tag.setText("true");
		tagList.add(tag);
		
		// 保存
		tag = new AlXmlTag("len");
		tag.setText(len);
		tagList.add(tag);

		String xml = "";
		try {
			xml = mALIQCreator.getXml();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return xml;
	
	}

}
